package clases;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.helpers.DefaultHandler;

public class StateXMLReader extends DefaultHandler {

	public StateXMLReader(String file) {
		processXML(file);
	}

	private void processXML(String parameter) {
		/*The factory to be created is set up to support XML namespaces
		by setting setNamespaceAware to true, and then a SAXParser instance
		is obtained from the factory by invoking its newSAXParser() method.
		*/
		try {
			SAXParserFactory spf = SAXParserFactory.newInstance();
			spf.setNamespaceAware(true);
			spf.setValidating(true);
			SAXParser saxParser = spf.newSAXParser();
			saxParser.parse(parameter, this);
		}
		catch (Exception ex) {
			System.err.println("% StateXMLReader.processXML(): " + ex);
		}
	}

}
